import React, { Component } from 'react';
import { Carousel } from 'antd-mobile';
import {withRouter} from 'react-router-dom'

//引入图片
import swiper1 from '@/assets/imgs/swiper-1.png'
import swiper2 from '@/assets/imgs/swiper-2.png'
import swiper3 from '@/assets/imgs/swiper-3.png'

@withRouter
class Swiper extends Component {

  state = {
    data: [swiper1, swiper2, swiper3],
    imgHeight: 176,
  }

  render() {
    return (
      <Carousel
        autoplay={true}
        infinite={true}
      >
        {this.state.data.map((val, index) => (
          <img
              key={index}
              src={val}
              alt=""
            style={{ width: '100%', verticalAlign: 'top' }}
            onClick={() => {
              console.log(this.props.history);
            }}
            />
        ))}
      </Carousel>
    );
  }
}

export default Swiper;
